package cn.szzsi.api.controller;

import cn.szzsi._Config;
import cn.szzsi.common.model.SiteConfig;
import cn.szzsi.service.HtmlService;
import cn.szzsi.service.SysHtmlService;
import com.jfinal.core.Controller;
import com.jfinal.kit.HttpKit;
import com.jfinal.plugin.activerecord.Db;

public class ApiController extends Controller {


    /**
     * 更改商户是否禁用状态
     */
    public void updateBusinessDisableStatus(){
        final String shopId=getPara("shopId");//店铺id
        _Config.fixedThreadPool.execute(new Runnable() {
            @Override
            public void run() {
                SiteConfig siteConfig=SiteConfig.getByShopId(shopId);
                //1.生成平台店铺首页
                SysHtmlService.service.indexBuildHtml();
                //3.生成该商家店铺首页
                HtmlService.service.indexBuildHtml(siteConfig);
            }
        });
    }


    public void deleteRelationBusiness(){
        String shopId=getPara("shopId");//店铺id
        Db.update("delete from mall_product where uid=?",shopId);
    }

    public static void main(String[] args) {
        HttpKit.get("http://mall.zhengy91.top/api/updateBusinessDisableStatus");
    }

}
